package zheezes.eisp.autotask.model;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import zheezes.eisp.data.orm.CalcTask;
import zheezes.eisp.data.orm.GroupPo;


public class GroupStatCalcTaskCreator extends AbstractAutoTaskCreator {
	@Override
	public List<CalcTask> mktask() {
		List<CalcTask> list = new ArrayList<CalcTask>();
		for (GroupPo root : dataAccessor.queryRootGroups()) {
			CalcTask task = new CalcTask();
			task.setTaskType(CalcTask.TASK_CALC_GROUP_STAT);
			task.setTargetType(CalcTask.TARGET_GROUP);
			task.setTargetId(root.getId());
			task.setStatus(CalcTask.STATUS_QUEUE);
			task.setSource(CalcTask.SOURCE_AUTO);
			task.setDate(schedule.getTime());
			task.setCreateDate(Calendar.getInstance().getTime());
			list.add(task);
		}
		return list;
	}

//	@Override
//	public int getType() {
//		// return GROUP_STAT_CALC_TASK;
//	}
}
